﻿using AiXiu.BLL;
using AiXiu.IBLL;
using AiXiu.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AiXiu.WebSite
{
    public partial class Play : System.Web.UI.Page
    {
        public string VideoId;
        public int UserId;
        public TBVideos Video;
        public TBUsers Author;
        public GetPlayInfoResult playInfo;
        public ILikeBLL likeBll;
        public int isLike;
        public long likeCount;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.VideoId = Request.QueryString["videoId"];
                TBUsers user = IdentityManager.ReadUser();
                this.UserId = user.Id;
                // 获取发布者信息
                IVideoBLL videoBLL = new VideoBLL();
                this.Video = videoBLL.GetVideoById(this.VideoId);
                this.Author = new UserManager().getUserById(Convert.ToInt32(Video.UserId));
                // 获取播放地址
                this.playInfo = videoBLL.InitPlay(this.VideoId);
                //获取点赞信息
                likeBll = new LikeBLL(this.VideoId);
                this.isLike = likeBll.IsLike(this.UserId);
                this.likeCount = likeBll.LikeCount();
            }
        }
    }
}